import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;

public class tes {


    public static void main(String[] args) {


        User user=new User();
        user.setId(1);
        user.setName("wnin");

        User user1=new User();
        user1.setId(1);
        user1.setName("wnin");

        User user2=new User();
        user2.setId(2);
        user2.setName("wnin");

        User user3=new User();
        user3.setId(3);
        user3.setName("wnin");

        User user4=new User();
        user4.setId(4);
        user4.setName("wnin");

        List<User> users=new LinkedList<>();
        Collections.addAll(users,user1,user4,user3,user2,user);

        List<Integer> collect = users.stream().map(User::getId).collect(Collectors.toList());
        System.out.println(collect);
    }
}
